﻿using MediatR;
using SBlogCore.Application.Demo.IServices;

namespace SBlogCore.Application.Demo.Event
{
    /// <summary>
    /// 
    /// </summary>
    public class DemoEventHandler : INotificationHandler<DemoEvent>
    {
        private IDemoService _service;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="service"></param>
        public DemoEventHandler(IDemoService service)
        {
            this._service = service;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="notification"></param>
        /// <param name="cancellationToken"></param>
        public async Task Handle(DemoEvent notification, CancellationToken cancellationToken)
        {
            Console.WriteLine(notification.test);
            await _service.HelloDemo();
        }
    }
}
